﻿using System.Net;
using System.Net.Sockets;
using Comunication;

namespace ServerDomain
{
    public class TcpAcceptManager : IAccepManager
    {
        public int AccepReceived(Socket handler, out ITcpPacketProcessor newTcpUtils)
        {
            ServerInfo.Instance.AddClient((IPEndPoint)handler.RemoteEndPoint, handler);
            newTcpUtils = new TcpPacketProcessor();
            if(ServerInfo.Instance.ExistsServer((IPEndPoint)handler.RemoteEndPoint))
                return Properties.Settings.Default.MaxServerServerBandwith;
            return ServerInfo.Instance.GetAvailableBandwith();
        }

    }
}
